{% extends "base.html" %}

{% block title %}上传脚本{% endblock %}

{% block content %}
<style>
/* 页面标题液态玻璃效果 */
h1 {
    color: #1C1C1E !important;
    position: relative;
    z-index: 2;
    font-weight: 700;
    margin-bottom: 2rem;
}

[data-theme="dark"] h1 {
    color: #ffffff !important;
}

/* 表单容器液态玻璃效果 */
.upload-form-container {
    background: rgba(255, 255, 255, 0.1) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    border-radius: 15px;
    padding: 2rem;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
    position: relative;
    overflow: hidden;
    margin-bottom: 2rem;
}

.upload-form-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
    pointer-events: none;
    opacity: 0.6;
}

.upload-form-container > * {
    position: relative;
    z-index: 1;
}

[data-theme="dark"] .upload-form-container {
    background: rgba(0, 0, 0, 0.3) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
}

[data-theme="dark"] .upload-form-container::before {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, transparent 50%);
}

/* 成功消息液态玻璃效果 */
.alert-success {
    background: rgba(40, 167, 69, 0.1) !important;
    backdrop-filter: blur(15px) !important;
    -webkit-backdrop-filter: blur(15px) !important;
    border: 1px solid rgba(40, 167, 69, 0.2) !important;
    color: #155724 !important;
    border-radius: 10px;
    padding: 1rem 1.5rem;
    box-shadow: 
        0 4px 12px rgba(40, 167, 69, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
    position: relative;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.alert-success::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(40, 167, 69, 0.1) 0%, transparent 50%);
    pointer-events: none;
    opacity: 0.6;
}

.alert-success > * {
    position: relative;
    z-index: 1;
}

[data-theme="dark"] .alert-success {
    background: rgba(40, 167, 69, 0.2) !important;
    border-color: rgba(40, 167, 69, 0.3) !important;
    color: #75b798 !important;
    box-shadow: 
        0 4px 12px rgba(40, 167, 69, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
}

[data-theme="dark"] .alert-success::before {
    background: linear-gradient(135deg, rgba(40, 167, 69, 0.15) 0%, transparent 50%);
}

/* 文件上传输入框液态玻璃效果 */
.form-control {
    background: rgba(255, 255, 255, 0.1) !important;
    backdrop-filter: blur(15px) !important;
    -webkit-backdrop-filter: blur(15px) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    color: #1C1C1E !important;
    border-radius: 10px;
    padding: 0.75rem 1rem;
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    position: relative;
    overflow: hidden;
}

/* 文件选择按钮液态玻璃效果 */
.form-control[type="file"] {
    background: rgba(255, 255, 255, 0.15) !important;
    border: 2px dashed rgba(255, 255, 255, 0.3) !important;
    border-radius: 15px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    position: relative;
    overflow: hidden;
}

.form-control[type="file"]::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 15px;
}

.form-control[type="file"]:hover {
    background: rgba(255, 255, 255, 0.2) !important;
    border-color: rgba(255, 255, 255, 0.4) !important;
    transform: translateY(-2px);
    box-shadow: 
        0 6px 20px rgba(0, 0, 0, 0.1),
        0 2px 8px rgba(0, 0, 0, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
}

.form-control[type="file"]:hover::before {
    opacity: 1;
}

.form-control[type="file"]:focus {
    background: rgba(255, 255, 255, 0.25) !important;
    border-color: rgba(255, 255, 255, 0.5) !important;
    box-shadow: 
        0 8px 25px rgba(0, 0, 0, 0.15),
        0 0 0 0.2rem rgba(255, 255, 255, 0.2) !important;
    transform: translateY(-3px);
}

.form-control[type="file"]:focus::before {
    opacity: 1;
}

.form-control::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 10px;
}

.form-control:focus {
    background: rgba(255, 255, 255, 0.15) !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
    color: #1C1C1E !important;
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.1),
        0 0 0 0.2rem rgba(255, 255, 255, 0.1) !important;
    transform: translateY(-1px);
}

.form-control:focus::before {
    opacity: 1;
}

[data-theme="dark"] .form-control {
    background: rgba(0, 0, 0, 0.3) !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
    color: #ffffff !important;
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
}

[data-theme="dark"] .form-control::before {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, transparent 50%);
}

[data-theme="dark"] .form-control:focus {
    background: rgba(0, 0, 0, 0.4) !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
    color: #ffffff !important;
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.3),
        0 0 0 0.2rem rgba(255, 255, 255, 0.1) !important;
}

/* 暗色模式文件选择按钮 */
[data-theme="dark"] .form-control[type="file"] {
    background: rgba(0, 0, 0, 0.4) !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
    color: #ffffff !important;
}

[data-theme="dark"] .form-control[type="file"]::before {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, transparent 50%);
}

[data-theme="dark"] .form-control[type="file"]:hover {
    background: rgba(0, 0, 0, 0.5) !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
    color: #ffffff !important;
    box-shadow: 
        0 6px 20px rgba(0, 0, 0, 0.4),
        0 2px 8px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.15) !important;
}

[data-theme="dark"] .form-control[type="file"]:focus {
    background: rgba(0, 0, 0, 0.6) !important;
    border-color: rgba(255, 255, 255, 0.4) !important;
    color: #ffffff !important;
    box-shadow: 
        0 8px 25px rgba(0, 0, 0, 0.5),
        0 0 0 0.2rem rgba(255, 255, 255, 0.2) !important;
}

/* 上传按钮液态玻璃效果 */
.btn-primary {
    background: rgba(255, 255, 255, 0.1) !important;
    backdrop-filter: blur(15px) !important;
    -webkit-backdrop-filter: blur(15px) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    color: #1C1C1E !important;
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    font-weight: 600;
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.btn-primary:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 
        0 6px 20px rgba(0, 0, 0, 0.15),
        0 4px 12px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
    background: rgba(255, 255, 255, 0.15) !important;
    color: #1C1C1E !important;
}

.btn-primary:hover::before {
    opacity: 1;
}

[data-theme="dark"] .btn-primary {
    background: rgba(0, 0, 0, 0.3) !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
    color: #ffffff !important;
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
}

[data-theme="dark"] .btn-primary::before {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, transparent 50%);
}

[data-theme="dark"] .btn-primary:hover {
    background: rgba(0, 0, 0, 0.4) !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
    color: #ffffff !important;
    box-shadow: 
        0 6px 20px rgba(0, 0, 0, 0.3),
        0 4px 12px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.15) !important;
}

/* 表单标签液态玻璃效果 */
.form-label {
    color: #1C1C1E !important;
    font-weight: 600;
    margin-bottom: 0.5rem;
    position: relative;
    z-index: 2;
}

[data-theme="dark"] .form-label {
    color: #ffffff !important;
}
</style>

    <div class="container mt-4">
    <h1>上传 Python 脚本</h1>
    
        {% with messages = get_flashed_messages() %}
            {% if messages %}
                {% for message in messages %}
                    <div class="alert alert-success" role="alert">{{ message }}</div>
                {% endfor %}
            {% endif %}
        {% endwith %}
    
    <div class="upload-form-container">
        <form method="post" enctype="multipart/form-data">
            <div class="mb-3">
                <label for="script" class="form-label">选择 Python 脚本文件</label>
                <input class="form-control" type="file" name="script" accept=".py" id="script">
            </div>
            <button type="submit" class="btn btn-primary">
                <i class="fas fa-upload me-2"></i>上传脚本
            </button>
        </form>
    </div>
    </div>
{% endblock %}